import { isShowNextStory } from "@/config/ads_ids";
import { classNameProgressBar } from "@/config/const_var";

export function set_progress_ratio(scrollTop: number, clientHeight: number) {
  if (scrollTop >= clientHeight) {
    isShowNextStory.value = false;
  } else {
    isShowNextStory.value = true;
  }
  let decimalRatio = scrollTop / clientHeight;
  if (decimalRatio >= 1) {
    decimalRatio = 1;
  }
  if (decimalRatio <= 0) {
    decimalRatio = 0;
  }
  let progressBar: any = document.querySelector(`.${classNameProgressBar}`);
  progressBar.style.width = decimalRatio * 100 + "%";
}
